﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainSite.Master" AutoEventWireup="true" CodeBehind="FlightsVessels.aspx.cs" Inherits="Garlic.BasicInfo.FlightsVessels" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register src="../UserControls/ServiceRouteTree.ascx" tagname="ServiceRouteTree" tagprefix="uc1" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<%@ Register src="~/UserControls/ServiceRouteTreePop.ascx" tagname="ServiceRouteTreePop" tagprefix="uc3" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Javascript/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    // <![CDATA[
        function OnChanged(cmb) {

            if (cmb.GetValue() != null) {
                gridst_liners.GetEditor("SLN_NAME").PerformCallback(cmb.GetValue().toString());
            }
        }

        function OnChanged1(cmb) {
            if (cmb.GetValue() != null) {
                gridst_liners.GetEditor("FLT_SCHDUL").PerformCallback(cmb.GetValue().toString());
            }
        }


        function CNNameChange(cmb) {
            try {
                var combineInfo = cmb.GetValue().toString();
                var result = combineInfo.split('+');

                gridst_liners.GetEditor("VSL_CNNAME").SetText(result[0]);
                $(".hiddenLNR_VSL_ID").val(result[1]);
            } catch (e) {
            }
        }

        function scheduleChanged(cmb) {

            if (cmb.GetValue() != null) {
                $(".hiddenST_FL_ID").val(cmb.GetValue().toString());
            }
        }
    // ]]> 
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
         <ContentTemplate>
                <div class="operat_box">
                      <asp:HiddenField ID="hidUserId" runat="server" />
                      <asp:HiddenField ID="hidUserType" runat="server" />
                  
                      <table class="form_tb" style="width:865px; margin-top:5px;" >
                          <tr>
                              <td>
                                  服务航线： 
                              </td>
                              <td>
                                   <uc1:ServiceRouteTree ID="ServiceRouteTree1" runat="server" />
                                   <div style="display:none">
                                        <asp:Button ID="btnFlt_schdul" runat="server" Text="Button" onclick="btnFlt_schdul_Click" />
                                   </div>
                                   <script type="text/javascript">
                                       function onFlt_schdulclick() {
                                           document.getElementById("<%=btnFlt_schdul.ClientID %>").click();
                                       }
                                   </script>
                              </td>
                              <td>
                                  航班班期：</td>
                              <td>
                                  <asp:DropDownList ID="ddlFlt_schdul" runat="server">
                                 </asp:DropDownList>
                                  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"  ControlToValidate="ddlFlt_schdul"
                                   ErrorMessage="*" ForeColor="Red" ValidationGroup="btnsubmit" ></asp:RequiredFieldValidator>
                              </td>
                              <td>
                                  &nbsp;</td>
                              <td>
                                  &nbsp;</td>
                              <td>
                                  <asp:Button ID="btnQuery" runat="server" onclick="btnQuery_Click" Text=" 查 询 " 
                                    />
                                 <%-- &nbsp;<asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text=" 添 加 " 
                                      ValidationGroup="btnsubmit" />--%>
                              </td>
                         </tr>
                     
                      
                     
                     </table>
                  
                      <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                          SelectMethod="GetRoutes1" 
                          TypeName="DAL.SystemManagement.ServiceRouteTreeDAL">
                          <SelectParameters>
                              <asp:ControlParameter ControlID="hidUserId" Name="userID" 
                                  PropertyName="Value" Type="Int32" />
                              <asp:ControlParameter ControlID="hidUserType" Name="userType" 
                                  PropertyName="Value" Type="String" />
                          </SelectParameters>
                      </asp:ObjectDataSource>
                </div>
              
                <dx:ASPxGridView ID="gridst_liners" ClientInstanceName="gridst_liners" 
                    runat="server" AutoGenerateColumns="False" Width="100%"   
                    KeyFieldName="LNR_ID" onpageindexchanged="gridst_liners_PageIndexChanged" 
                    onrowdeleting="gridst_liners_RowDeleting" 
                    onrowupdating="gridst_liners_RowUpdating" 
                    onrowvalidating="gridst_liners_RowValidating" 
                    oncelleditorinitialize="gridst_liners_CellEditorInitialize" 
                    onrowinserting="gridst_liners_RowInserting">
                    <Columns>
                    
                        <dx:GridViewCommandColumn VisibleIndex="0">
                            <editbutton text="编辑" visible="True"></editbutton>
                            <newbutton text="添加" visible="True"></newbutton>
                            <deletebutton text="删除" visible="True"></deletebutton>
                        </dx:GridViewCommandColumn>

                        <dx:GridViewDataComboBoxColumn Caption="航线1" Visible="false" FieldName="SRT_RTCHNNM" VisibleIndex="1">
                            <EditFormSettings  Visible="True" VisibleIndex="1" />

                            <PropertiesComboBox TextField="SRT_RTCHNNM" ValueField="SRT_ID" EnableSynchronization="False"
                                IncrementalFilteringMode="StartsWith" >
                                <ClientSideEvents   SelectedIndexChanged="function(s, e) { OnChanged(s); }"></ClientSideEvents>
                            </PropertiesComboBox>
                        </dx:GridViewDataComboBoxColumn>

                        <dx:GridViewDataComboBoxColumn Caption="航线2"   FieldName="SLN_NAME" VisibleIndex="2">
                            <EditFormSettings   Visible="True" VisibleIndex="2" />
                            <PropertiesComboBox  EnableSynchronization="False" ValueField="SLN_ID" IncrementalFilteringMode="StartsWith" >
                             <ClientSideEvents  EndCallback="function(s, e) { OnChanged1(s); }" TextChanged="function(s, e) { OnChanged1(s); }"></ClientSideEvents>
                            </PropertiesComboBox>
                        </dx:GridViewDataComboBoxColumn>

                         <dx:GridViewDataComboBoxColumn Caption="班期" FieldName="FLT_SCHDUL" >
                         <EditFormSettings Visible="True" VisibleIndex="4" />
                            <PropertiesComboBox   EnableSynchronization="False" IncrementalFilteringMode="StartsWith" >
                             <ClientSideEvents  EndCallback="function(s, e) { scheduleChanged(s); }" TextChanged="function(s, e) { scheduleChanged(s); }"></ClientSideEvents>
                            </PropertiesComboBox>
                          </dx:GridViewDataComboBoxColumn>

                        <dx:GridViewDataComboBoxColumn Caption="英文船名" Visible="false" FieldName="VSL_ENNAME" >
                           <%-- <EditFormSettings Visible="True" VisibleIndex="4" />
                            <PropertiesComboBox  EnableSynchronization="False" IncrementalFilteringMode="StartsWith" />--%>
                        </dx:GridViewDataComboBoxColumn>

                        <dx:GridViewDataTextColumn Caption="船舶代码"   Visible="false" FieldName="LNR_VSL_CD" VisibleIndex="5"> </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="船舶中文名" FieldName="VSL_CNNAME" VisibleIndex="6"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataComboBoxColumn Caption="船舶英文名"  FieldName="NAME" VisibleIndex="7">
                            <EditFormSettings Visible="True" VisibleIndex="4" />
                            <PropertiesComboBox  EnableSynchronization="False" IncrementalFilteringMode="StartsWith">
                            <ClientSideEvents EndCallback="function(s, e) { CNNameChange(s); }" TextChanged="function(s, e) { CNNameChange(s); }" />
                            </PropertiesComboBox>
                        </dx:GridViewDataComboBoxColumn>
                        <dx:GridViewDataTextColumn Caption="航班船编号" FieldName="LNR_NO" VisibleIndex="8"> 
                        <EditFormSettings  Visible="False"/>
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="进口航次步长" FieldName="LNR_ISTEP" VisibleIndex="9"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="出口航次步长" FieldName="LNR_ESTEP" VisibleIndex="10"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="进口航次（初始）" FieldName="LNR_IVOYAGE" VisibleIndex="11"> </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="出口航次（初始）" FieldName="LNR_EVOYAGE" VisibleIndex="12"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="进口箱量" FieldName="LNR_IAMOUNT" VisibleIndex="13"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="出口箱量" FieldName="LNR_EAMOUNT" VisibleIndex="14"> </dx:GridViewDataTextColumn>
                    </Columns>
                </dx:ASPxGridView>

        </ContentTemplate>
    </asp:UpdatePanel>
    <!--对船舶ID的保存-->
       <input type="hidden" id="hiddenLNR_VSL_ID" value="" runat="server" class="hiddenLNR_VSL_ID" />

       <input type="hidden" id="hiddenST_FL_ID" value="" runat="server" class="hiddenST_FL_ID" />
</asp:Content>
